#include<vector>
#include<algorithm>
#include<unordered_set>
using namespace std;
class Solution {
public:
    int findMinArrowShots(vector<vector<int>>& points) {
        sort(points.begin(), points.end(), [](const vector<int>& left, const vector<int>& right) {
            return left[1] < right[1];
            });
        int ans = 0;
        int shot = -1;
        bool hasShot = false;
        for (auto& point : points) {
            if (!hasShot||point[0] > shot) {
                ++ans;
                shot = point[1];
                hasShot = true;
            }
        }
        return ans;

    }
};